package com.wzh.house.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzh.common.utils.PageUtils;
import com.wzh.common.utils.Query;

import com.wzh.house.dao.RentUserAttentionDao;
import com.wzh.house.entity.RentUserAttentionEntity;
import com.wzh.house.service.RentUserAttentionService;


@Service("rentUserAttentionService")
public class RentUserAttentionServiceImpl extends ServiceImpl<RentUserAttentionDao, RentUserAttentionEntity> implements RentUserAttentionService {

    @Autowired
    private RentUserAttentionDao rentUserAttentionDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<RentUserAttentionEntity> page = this.page(
                new Query<RentUserAttentionEntity>().getPage(params),
                new QueryWrapper<RentUserAttentionEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public Integer getCountByRentAndUserId(Integer houseId, Integer userId) {
        return rentUserAttentionDao.getCountByRentAndUserId(houseId,userId);
    }

    @Override
    public void del(RentUserAttentionEntity rentUserAttention) {
        Integer i=rentUserAttentionDao.del(rentUserAttention.getRentId(),rentUserAttention.getUserId());
    }

    @Override
    public void add(RentUserAttentionEntity rentUserAttention) {
        Integer i=rentUserAttentionDao.add(rentUserAttention.getRentId(),rentUserAttention.getUserId());
    }

}